package sjtu.rfid.rri.services.tag;

import java.io.Serializable;

public class Bank implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4658576788933205289L;

	private BankType bankType;
	// Hex Data, from low to high (00 ~ XF)
	private String data;

	/**
	 * @return the bankType
	 */
	public BankType getBankType() {
		return bankType;
	}

	/**
	 * @param bankType
	 *            the bankType to set
	 */
	public void setBankType(BankType bankType) {
		this.bankType = bankType;
	}

	/**
	 * @return the data
	 */
	public String getData() {
		return data;
	}

	/**
	 * @param data
	 *            the data to set
	 */
	public void setData(String data) {
		this.data = data;
	}

	@Override
	public int hashCode() {
		int result = 17;
		if (null != bankType) {
			result = 37 * result + bankType.hashCode();
		}
		if (null != data) {
			result = 37 * result + data.hashCode();
		}
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Bank))
			return false;

		Bank bank = (Bank) obj;
		return (bankType == null ? bank.bankType == null : bankType
				.equals(bank.bankType))
				&& (data == null ? bank.data == null : data.equals(bank.data));
	}

	@Override
	public String toString() {
		return "bank[bankType=" + bankType + ",data=" + data + "]";
	}
}
